package com.rightrule.sequence.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
public enum SequenceEnum {
    RULE_FLOW_SEQ("RULE_FLOW_SEQ", "1", "default");

    SequenceEnum(String name, String value, String rule) {
        this.name = name;
        this.value = value;
        this.rule = rule;
    }

    /**
     * SEQ的名称
     */
    public String name;

    /**
     * SEQ对应的值，用于区分seq类型
     */
    public String value;

    /**
     * SEQ生成规则
     */
    public String rule;


    public static SequenceEnum fromName(String value) {
        for (SequenceEnum sequenceEnum : SequenceEnum.values()) {
            if (StringUtils.equals(value, sequenceEnum.getValue())) {
                return sequenceEnum;
            }
        }
        return null;
    }
}
